<?php
/**
* @package Super header module for Joomla! 1.6
* @author http://www.joomla2you.com
* @copyright (C) 2011- joomla2you.Com
* @license PHP files are GNU/GPL
**/
defined('JPATH_BASE') or die();
jimport('joomla.html.html');
jimport('joomla.form.formfield');
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Renders a list element
*
*/

class JFormFieldStylies extends JFormFieldList
{
/**
* Element type
*
* @access	protected
* @var		string
*/
protected $type = 'stylies';
//var	$_name = 'stylies';

public function getOptions()
{
//Get value of layout style from database
$db = &JFactory::getDBO();
$cId = JRequest::getVar('cid','');

if($cId !='') $cId = $cId[0];
if($cId == ''){
$cId = JRequest::getVar('id');
}
$sql = "SELECT params FROM #__modules WHERE id=$cId";
$db->setQuery($sql);
$paramsConfigObj = $db->loadObjectList();
$db->setQuery($sql);
$data = $db->loadResult(); 
$params = new JParameter($data);
$layoutStyle = $params->get('layout_style','ju_slide2');
//End get value of layout style
//$class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="inputbox"' );
$options = array ();
$val = "ju_slide2";
$text = "Supershow";
$options[] = JHTML::_('select.option', $val, JText::_($text));
?>
<script type="text/javascript">	
var jpaneAutoHeight = function(){
$$('.jpane-slider').each(function(item){
item.setStyle('height','auto'); 
});
};
window.addEvent('load',function(){		     		     
setTimeout(jpaneAutoHeight,400);	
var rowNewsHeight = $('jform_params_ju_news_thumbs').getParent();
for(i=0;i<=6;i++){
rowNewsHeight.addClass('ju_slide_stylenews');		    	  
rowNewsHeight = rowNewsHeight.getNext();		    	 
}

var rowJU2Width = $('jform_params_ju_supershow_thumbs').getParent();
for(i=0;i<=10;i++){
rowJU2Width.addClass('ju_slide_style2');
rowJU2Width = rowJU2Width.getNext();
}
var rowJUCoolshowHeight = $('jform_params_ju_coolshow_thumbs').getParent();
for(i=0;i<=13;i++){
rowJUCoolshowHeight.addClass('ju_slide_stylecoolshow');
rowJUCoolshowHeight = rowJUCoolshowHeight.getNext();
}
var rowJUHeadersliderHeight = $('jform_params_ju_headerslider_thumbs').getParent();
for(i=0;i<=9;i++){
rowJUHeadersliderHeight.addClass('ju_slide_styleheaderslider');
rowJUHeadersliderHeight = rowJUHeadersliderHeight.getNext();
}
var rowJUHeaderslider1Width = $('jform_params_ju_headerslider1_thumbs').getParent();					
for(i=0;i<=9;i++){
rowJUHeaderslider1Width.addClass('ju_slide_styleheaderslider1');
rowJUHeaderslider1Width = rowJUHeaderslider1Width.getNext();
}
var rowJUShowcaseWidth = $('jform_params_ju_showcase_thumbs').getParent();
for(i=0;i<=8;i++){
rowJUShowcaseWidth.addClass('ju_slide_styleshowcase');
rowJUShowcaseWidth = rowJUShowcaseWidth.getNext();
}
var rowJU7 = $('jform_params_ju_ju7_main_thumbs').getParent();
for(i=0;i<=6;i++){
rowJU7.addClass('ju_slide_style7');
rowJU7 = rowJU7.getNext();
}
var rowJUSlidershow = $('jform_params_ju_slidershow_thumbs').getParent();
for(i=0;i<=8;i++){
rowJUSlidershow.addClass('ju_slide_styleslidershow');
rowJUSlidershow = rowJUSlidershow.getNext();
}
var rowJUHead9 = $('jform_params_ju_ju9_main_thumbs').getParent();
for(i=0;i<=6;i++){
rowJUHead9.addClass('ju_slide_style9');
rowJUHead9 = rowJUHead9.getNext();
}
var juSlidershow = $$('.ju_slide_styleslidershow');
var juNews = $$('.ju_slide_stylenews');
var juStyle2 = $$('.ju_slide_style2');	
var juCoolshow = $$('.ju_slide_stylecoolshow');     
var juHeaderslider = $$('.ju_slide_styleheaderslider');
var juHeaderslider1 = $$('.ju_slide_styleheaderslider1'); 					
var juShowcase = $$('.ju_slide_styleshowcase');
var juStyle7 = $$('.ju_slide_style7');
var juStyle9 = $$('.ju_slide_style9');
var layout = "<?php echo $layoutStyle; ?>";
var selectStyle = function(style){				
switch(style){               
case "ju_slide1":				
juNews.each(function(item){
item.setStyle('display','');
}.bind(this));
juSlidershow.each(function(item){
item.setStyle('display','none');
}.bind(this));
juStyle2.each(function(item){
item.setStyle('display','none');
});
juCoolshow.each(function(item){
item.setStyle('display','none');
});
juHeaderslider.each(function(item){
item.setStyle('display','none');
});
juHeaderslider1.each(function(item){
item.setStyle('display','none');
});
juShowcase.each(function(item){
item.setStyle('display','none');
});
juStyle7.each(function(item){
item.setStyle('display','none');
});
juStyle9.each(function(item){
item.setStyle('display','none');
});
break;
case "ju_slide2":
juNews.each(function(item){
item.setStyle('display','none');
}.bind(this));
juSlidershow.each(function(item){
item.setStyle('display','none');
}.bind(this));
juStyle2.each(function(item){
item.setStyle('display','');
});
juCoolshow.each(function(item){
item.setStyle('display','none');
});
juHeaderslider.each(function(item){
item.setStyle('display','none');
});
juHeaderslider1.each(function(item){
item.setStyle('display','none');
});
juShowcase.each(function(item){
item.setStyle('display','none');
});
juStyle7.each(function(item){
item.setStyle('display','none');
});
juStyle9.each(function(item){
item.setStyle('display','none');
});
break;
case "ju_slide3":
juNews.each(function(item){
item.setStyle('display','none');
}.bind(this));
juSlidershow.each(function(item){
item.setStyle('display','none');
}.bind(this));
juStyle2.each(function(item){
item.setStyle('display','none');
});
juCoolshow.each(function(item){
item.setStyle('display','');
});
juHeaderslider.each(function(item){
item.setStyle('display','none');
});
juHeaderslider1.each(function(item){
item.setStyle('display','none');
});
juShowcase.each(function(item){
item.setStyle('display','none');
});
juStyle7.each(function(item){
item.setStyle('display','none');
});
juStyle9.each(function(item){
item.setStyle('display','none');
});
break;
case "ju_slide4":
juNews.each(function(item){
item.setStyle('display','none');
}.bind(this));
juSlidershow.each(function(item){
item.setStyle('display','none');
}.bind(this));
juStyle2.each(function(item){
item.setStyle('display','none');
});
juCoolshow.each(function(item){
item.setStyle('display','none');
});
juHeaderslider.each(function(item){
item.setStyle('display','');
});
juHeaderslider1.each(function(item){
item.setStyle('display','none');
});
juShowcase.each(function(item){
item.setStyle('display','none');
});
juStyle7.each(function(item){
item.setStyle('display','none');
});
juStyle9.each(function(item){
item.setStyle('display','none');
});
break;
case "ju_slide5":
juNews.each(function(item){
item.setStyle('display','none');
}.bind(this));
juSlidershow.each(function(item){
item.setStyle('display','none');
}.bind(this));
juStyle2.each(function(item){
item.setStyle('display','none');
});
juCoolshow.each(function(item){
item.setStyle('display','none');
});
juHeaderslider.each(function(item){
item.setStyle('display','none');
});
juHeaderslider1.each(function(item){
item.setStyle('display','none');
});
juShowcase.each(function(item){
item.setStyle('display','');
});
juStyle7.each(function(item){
item.setStyle('display','none');
});
juStyle9.each(function(item){
item.setStyle('display','none');
});
break;
case "ju_slide6":
juNews.each(function(item){
item.setStyle('display','none');
}.bind(this));
juSlidershow.each(function(item){
item.setStyle('display','none');
}.bind(this));
juStyle2.each(function(item){
item.setStyle('display','none');
});
juCoolshow.each(function(item){
item.setStyle('display','none');
});
juHeaderslider.each(function(item){
item.setStyle('display','none');
});
juHeaderslider1.each(function(item){
item.setStyle('display','');
});
juShowcase.each(function(item){
item.setStyle('display','none');
});
juStyle7.each(function(item){
item.setStyle('display','none');
});
juStyle9.each(function(item){
item.setStyle('display','none');
});
break;
case "ju_slide7":
juNews.each(function(item){
item.setStyle('display','none');
}.bind(this));
juSlidershow.each(function(item){
item.setStyle('display','none');
}.bind(this));
juStyle2.each(function(item){
item.setStyle('display','none');
});
juCoolshow.each(function(item){
item.setStyle('display','none');
});
juHeaderslider.each(function(item){
item.setStyle('display','none');
});
juHeaderslider1.each(function(item){
item.setStyle('display','none');
});
juShowcase.each(function(item){
item.setStyle('display','none');
});
juStyle7.each(function(item){
item.setStyle('display','');
});
juStyle9.each(function(item){
item.setStyle('display','none');
});
break;
case "ju_slide8":
juNews.each(function(item){
item.setStyle('display','none');
}.bind(this));
juSlidershow.each(function(item){
item.setStyle('display','');
}.bind(this));
juStyle2.each(function(item){
item.setStyle('display','none');
});
juCoolshow.each(function(item){
item.setStyle('display','none');
});
juHeaderslider.each(function(item){
item.setStyle('display','none');
});
juHeaderslider1.each(function(item){
item.setStyle('display','none');
});
juShowcase.each(function(item){
item.setStyle('display','none');
});
juStyle7.each(function(item){
item.setStyle('display','none');
});
juStyle9.each(function(item){
item.setStyle('display','none');
});
break;
case "ju_slide9":
juNews.each(function(item){
item.setStyle('display','none');
}.bind(this));
juSlidershow.each(function(item){
item.setStyle('display','none');
}.bind(this));
juStyle2.each(function(item){
item.setStyle('display','none');
});
juCoolshow.each(function(item){
item.setStyle('display','none');
});
juHeaderslider.each(function(item){
item.setStyle('display','none');
});
juHeaderslider1.each(function(item){
item.setStyle('display','none');
});
juShowcase.each(function(item){
item.setStyle('display','none');
});
juStyle7.each(function(item){
item.setStyle('display','none');
});
juStyle9.each(function(item){
item.setStyle('display','');
});
break;	
}              
};
selectStyle(layout);                          
$('jform_params_layout_style').addEvent('change',function(){
selectStyle(this.value);                
});        
});		 
</script>
<?php
array_unshift($options, JHtml::_('select.option', '0', JText::_('--Select--'), 'value', 'text', $value, $control_name.$name));
return $options;
}
}
